package com.wangtianxiang.sxp.back;

import com.baomidou.mybatisplus.core.config.GlobalConfig;
import com.wangtianxiang.sxp.back.handler.MyMetaObjectHandler;
import com.wangtianxiang.sxp.dbbase.config.DbbaseAutoConfiguration;
import com.wangtianxiang.sxp.dbbase.config.annotation.EnableSxpDbConfig;
import lombok.extern.log4j.Log4j;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;

import java.util.HashMap;
import java.util.Map;

/**
 * @author wangtianxiang
 * @description 后台系统启动类
 * @date 2021/4/17
 */
@EnableSxpDbConfig  //启用平台自定义数据源注册
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class},scanBasePackages = {"com.wangtianxiang.sxp"})// 排除指定自动配置类
public class SxpBackApplication {

    static{
        Map<String, GlobalConfig> globalConfigMap = new HashMap<>();
        GlobalConfig globalConfig = new GlobalConfig();
        globalConfig.setMetaObjectHandler(new MyMetaObjectHandler());
        globalConfigMap.put("*",globalConfig);
        DbbaseAutoConfiguration.mybatisConfigEnhanced(globalConfigMap,null);
    }

    public static void main(String[] args) {
        SpringApplication.run(SxpBackApplication.class);
    }
}
